/**
  分页组件
 */
<template>
  <div>
    <!-- <div class="pagination-line" v-if="pageSize < total"></div> -->
    <div class="pagination-box floatR" v-if="pageSize < total">
      <span class="pagesize">每页{{ pageSize }}条</span>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-size="pageSize"
        layout="total, prev, pager, next, jumper"
        fixed="right"
        :total="total"
      ></el-pagination>
    </div>
    <div class="clear"></div>
  </div>
</template>

<script>
import { reactive, ref, toRefs, getCurrentInstance } from "vue";
export default {
  props: {
    total: {
      type: Number,
    },
    jumpPage: {
      type: Function,
    },
    pageSizeMax: {
      type: Number,
    },
  },
  setup(props) {
    let pageSize = ref(props.pageSizeMax);
    let currentPage = ref(1);

    const handleSizeChange = (val) => {
      pageSize = val;
      currentPage.value = 1;
    };

    const handleCurrentChange = (val) => {
      currentPage.value = val;
      props.jumpPage(val);
    };

    return {
      pageSize,
      handleSizeChange,
      handleCurrentChange,
      currentPage,
    };
  },
};
</script>

<style lang="scss" scoped>
.pagination-box {
  display: flex;
  margin-right: 0;
  padding-top: 11px;
  // height: 56px;
  .pagesize {
    display: inline-block;
    margin-top: 2px;
    margin-right: 10px;
    min-width: 35.5px;
    height: 28px;
    color: #606266;
    vertical-align: middle;
    font-size: 13px;
    line-height: 28px;
  }
}
.pagination-line {
  margin-top: 16px;
  margin-right: -24px;
  margin-left: -24px;
  border-bottom: 1px solid #eee;
  // width: 100%;
  // height: 20px;
  // background: red;
}
.el-pagination {
  display: inline-block;
  vertical-align: middle;
}
.el-table-footer-wrapper {
  border-left: 0px;
}
.el-table-footer-wrapper--border td {
  border-right: 0px;
}
.el-table-footer-wrapper::after {
  background-color: #fff;
}

.el-table-footer-wrapper td {
  color: #404040;
  font-weight: normal;
  font-size: 14px;
}
.floatR {
  float: right;
}
</style>